package service;

import com.dao.AccountCRUDDao;
import pojo.Account;
import utils.MyUtil;

import java.util.List;

public class AccountCRUDServiceImpl implements AccountCRUDService {

    private AccountCRUDDao dao = MyUtil.getMybatisSqlSession().getMapper(AccountCRUDDao.class);

    @Override
    public int insertAccount(Account account) {
        return dao.insertAccount(account);
    }

    @Override
    public int insertAccountReturnId(Account account) {
        return dao.insertAccountReturnId(account);
    }

    @Override
    public Account selectAccountByActNo(String actno) {
        return dao.selectAccountByActNo(actno);
    }

    @Override
    public List<Account> selectAccount() {
        List<Account> accounts = dao.selectAccount();
        return accounts;
    }

    @Override
    public void deleteAccount(int id) {
        dao.deleteAccount(id);
    }

    @Override
    public void updateAccount(Account account) {
        dao.updateAccount(account);
    }
}
